# include <iostream>

using namespace std;

int BF(char * a, char * b )//在字符串a中查找字符串b，失败返回-1，成功返回字符串b 在a中的起始下标
{
int i = 0;
int j = 0;

while (*(a+i) != '\0')
{
    j = 0;
    while (*(b+j) == *(a+i))
    {
        if (*(b+j+1) == '\0')
        {
        return i - j;
        }
        else
        {
        ++j;
        ++i;
        }
    }
    i = i - j;
    ++i;
}
return -1;



}

int main(int argc, char ** argv)
{
char S[] ="1234567";
char T0[] = "56";
char T1[] = "54";

cout<<BF(S, T0)<<endl;
cout<<BF(S, T1)<<endl;

return 0;
}